<!--学生维护证书-->
<style type="text/css">
	.zhengshu {
		margin: 0 auto;
		height: 150px;
		padding-top: 2px;
		padding-bottom: 2px;
		padding-left: 10px;
		padding-right: 10px;
		border-bottom: 1px solid gainsboro;
		cursor: pointer;
	}
	
	.zhengshu:hover {
		background-color: gainsboro;
	}
	
	.btn3 {
		display: inline-block;
		float: right;
		width: 85px;
		height: 150px;
		padding-top: 25px;
		margin-left: 25px;
	}
	
	.title_div {
		display: inline;
		font-size: 24px;
		font-weight: 600;
		margin-top: 10px;
		margin-left: 20px;
		max-width: 960px;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	
	.img_div {
		display: inline;
		width: 100px;
		height: 120px;
		margin-top: 12px;
	}
	
	.xiugai {
		margin-bottom: 10px;
	}
	
	.add_zhengshu {
		float: right;
		margin-top: 10px;
		margin-right: 32px;
	}
	
	#submit_ {
		position: fixed;
	}
	
	#location_ {
		border-top-right-radius: 4px;
		border-bottom-right-radius: 4px;
	}
</style>

<div class="modal-dialog modal fade" id="submit_">
	<div class="modal-content">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal">&times;</button>
			<h4>添加证书</h4>
		</div>
		<div class="modal-body">
			<div class="input-group margintop" style="margin-bottom: 20px;">
				<span class="input-group-addon">证书名称</span>
				<input type="text" id="zhengshuname" class="form-control" placeholder="请输入证书名称" aria-describedby="sizing-addon1">
			</div>
			<div class="file-loading input-group">
				<span class="input-group-addon">证书封面</span>
				<input id='location_' class="form-control" onclick="$('#fileName_').click();" placeholder="请上传证书封面">
				<form action="/" method="post" id="form_">
					<input type="file" name="fileName" id="fileName_" accept=".jpg,.jpeg,.png,.gif" onchange="$('#location_').val($('#fileName_').val());" style="display: none;">
				</form>
			</div>
		</div>
		<div class="modal-footer">
			<button type="button" class="btn btn-default" class="close" data-dismiss="modal">取消</button>
			<button type="button" class="btn btn-primary add_" class="close" data-dismiss="modal">添加</button>
		</div>
	</div>
</div>

<div class="modal-dialog modal fade" id="xiugai_modal">
	<div class="modal-content">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal">&times;</button>
			<h4>添加证书</h4>
		</div>
		<div class="modal-body">
			<div class="input-group margintop" style="margin-bottom: 20px;">
				<span class="input-group-addon">证书名称</span>
				<input type="text" id="zhengshuname" class="form-control" placeholder="请输入证书名称" aria-describedby="sizing-addon1">
			</div>
			<div class="file-loading input-group">
				<span class="input-group-addon">证书封面</span>
				<input id='location_' class="form-control" onclick="$('#fileName_').click();" placeholder="请上传证书封面">
				<form action="/" method="post" id="form_">
					<input type="file" name="fileName" id="fileName_" accept=".jpg,.jpeg,.png,.gif" onchange="$('#location_').val($('#fileName_').val());" style="display: none;">
				</form>
			</div>
		</div>
		<div class="modal-footer">
			<button type="button" class="btn btn-default" class="close" data-dismiss="modal">取消</button>
			<button type="button" class="btn btn-primary xiugai_" class="close" data-dismiss="modal">修改</button>
		</div>
	</div>
</div>

<h3 class="text-left" style="margin-bottom: 20px;">维护证书</h3>

<div id="big">
	<div class="zhengshu" id="look1_` + list[i].iid + `">
		<div class="btn3">
			<button class="xiugai btn btn-primary" id="xiugai_` + list[i].iid + `" value="` + list[i].iid + `">修改</button>
			<button class="remove btn btn-primary" id="remove_` + list[i].iid + `" value="` + list[i].iid + `">删除</button>
		</div>
		<input type="hidden" id="hidden" value="` + list[i].iid + `" />
		<img class="img_div" src="img/DefaultHead.jpg" />
		<div class="title_div">软件设计师</div>
	</div>
	<div class="zhengshu" id="look1_` + list[i].iid + `">
		<div class="btn3">
			<button class="xiugai btn btn-primary" id="xiugai_` + list[i].iid + `" value="` + list[i].iid + `">修改</button>
			<button class="remove btn btn-primary" id="remove_` + list[i].iid + `" value="` + list[i].iid + `">删除</button>
		</div>
		<input type="hidden" id="hidden" value="` + list[i].iid + `" />
		<img class="img_div" src="img/DefaultHead.jpg" />
		<div class="title_div">软件设计师</div>
	</div>
</div>
<nav aria-label="...">
	<ul class="pager">
		<button type="button" class="btn btn-primary add_zhengshu" data-toggle="modal" data-target="#submit_">添加证书</button>
	</ul>
</nav>

<script>
	scrollTo(0, 0)

	$('#submit').click(function() {
		$.ajax({
			xhrFields: {
				withCredentials: true
			},
			type: 'POST',
			url: getFullURL("admin/add-company"),
			data: {
				award: $('#zhengshuname').val(),
				cover: 1
			},
			dataType: 'json',
			success: function(data) {
				if(data.status == 0) {
					$('#submit1').modal({
						keyboard: true,
						show: true
					})
				} else if(data.status == -1) {
					$('#shibai').modal({
						keyboard: true,
						show: true
					})
				}
			},
			error: function(err) {
				alert("请求异常，请重新登录！", function() {
					$(location).attr('href', './login.html');
				})
			}
		})
	})

	var formData = new FormData($("#form")[0])
	$('#daoru').click(function() {
		$.ajax({
			xhrFields: {
				withCredentials: true
			},
			type: 'POST',
			url: getFullURL("admin/up-cyfile"),
			data: formData,
			dataType: 'json',
			cache: false,
			processData: false, // 不加会报错
			contentType: false, // 不加会报错
			success: function(data) {
				if(data.status == 0) {
					$('#shangchuan').modal({
						keyboard: true,
						show: true
					})
				} else if(data.status == -1) {
					$('#shangchuan1').modal({
						keyboard: true,
						show: true
					})
				}
			},
			error: function(err) {
				alert("请求异常，请重新登录！", function() {
					$(location).attr('href', './login.html');
				})
			}
		})
	})
</script>